package day10.LX;

import java.util.ArrayList;
import java.util.List;

public class Lian01 {
    public static void main(String[] args) {
//JDK1.9 新添加功能
        ArrayList<String>list1=new ArrayList<>(/*List.of("张三丰","张无忌","c")*/);
        ArrayList<String>list2=new ArrayList<>();
        for (String s : list1) {
            if (s.startsWith("张")){
                list2.add(s);
            }
        }
        ArrayList<String>list3=new ArrayList<>();
        for (String s : list2) {
            if (s.length()==3){
                list3.add(s);
            }
        }
        for (String s : list3) {
            System.out.println(s);
        }
        list1.stream().filter(
                s->s.startsWith("张"))
                .filter(s->s.length()==3)
                .forEach(s -> System.out.println(s));
    }
}
